FROM 172.17.15.166:5050/library/node:18.16.0-alpine3.17 as builder

WORKDIR /det_scheduler_ui

COPY . .

RUN npm install --unsafe-perm --registry=https://registry.npmmirror.com/

RUN npm run build

FROM 172.17.15.166:5050/library/nginx:stable-alpine3.17-slim AS prod

WORKDIR /usr/share/nginx/html

COPY --from=builder /det_scheduler_ui/dist /usr/share/nginx/html

RUN chmod 755 -R /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
